'''
作者：20183215董振龙
文件名称：第八课测试.py
时间：2020年4月22日20点18分
'''
import os
import os.path
tplt = "{0:^10}\t{1:^10}\t{2:^10}\t{3:^10}\t"
if (os.path.exists("C:/Users/28920/Desktop/1832/183215.txt"))==False:
    file = open("C:/Users/28920/Desktop/1832/183215.txt", "a+")
    file.write(tplt.format("学号","姓名","课程","成绩"))
    file.write("\n")
    file.close()
file=open("C:/Users/28920/Desktop/1832/183215.txt","a+")
a=["","","",""]
b=["学号:","姓名:","课程:","成绩:"]
i=1
while i==1:
    for i in range(4):
        a[i] = input(b[i])
    file.write(tplt.format(a[0], a[1], a[2], a[3]))
    file.write("\n")
    i=int(input("是否继续输入\n1.是\n2.否\n"))
file=open("C:/Users/28920/Desktop/1832/183215.txt","r")
print(file.read())
